package com.atguigu.oss.controller;

import com.atguigu.common.Result;
import com.atguigu.oss.service.OssService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

/**
 * @author Summerday
 */

@RestController
@RequestMapping("/eduOss/fileOss")
@Api(value = "ossController")
public class OssController {

    @Autowired
    private OssService ossService;

    //上传头像
    @ApiOperation(value = "上传文件")
    @PostMapping
    public Result uploadOssFile(@RequestParam("file") MultipartFile file){

        //获取上传文件
        String url = ossService.uploadFile(file);

        return Result.ok().data("url",url);

    }


}
